package com.hyts.uuidkey.snowflake;

/**
 * Copyright [2019] [LiBo/Alex of copyright liboware@gmail.com ]
 * <p>
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * <p>
 * http://www.apache.org/licenses/LICENSE-2.0
 * <p>
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
public interface SnowflakeConfig {

    /**
     * 时间起始标记点，作为基准，一般取系统的最近时间（一旦确定不能变动）
     */
    long TWEPOCH = 1502584652944L;

    /**
     * 机器标识位数
     */
   long WORK_ID_BITS = 5L;
    /**
     * 数据中心标识位数
     */
   long DATA_CENTERID_BITS = 5L;
    /**
     * 机器ID最大值
     */
   long MAX_WORKER_ID = -1L ^ (-1L << WORK_ID_BITS);
    /**
     * 数据中心ID最大值
     */
   long MAX_DATA_CENTER_ID = -1L ^ (-1L << DATA_CENTERID_BITS);

    /**
     * 毫秒内自增位
     */
   long SEQUENCE_BITS = 12L;

    /**
     * 机器ID偏左移12位
     */
   long WORKERID_SHIFT = SEQUENCE_BITS;

    /**
     * 数据中心ID左移17位
     */
   long DATA_CENTERID_SHIFT = SEQUENCE_BITS + DATA_CENTERID_BITS;

    /**
     * 时间毫秒左移22位
     */
   long TIMESTAMPLEFT_SHIFT = DATA_CENTERID_BITS + SEQUENCE_BITS+WORK_ID_BITS;

    /**
     * 序列掩码
     */
   long SEQUENCE_MASK = -1L ^ (-1L << SEQUENCE_BITS);


}
